home *** CD-ROM | disk | FTP | other *** search
- /*
- * The contents of this file are subject to the Netscape Public
- * License Version 1.1 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.mozilla.org/NPL/
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is Netscape
- * Communications Corporation. Portions created by Netscape are
- * Copyright (C) 1998-1999 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s):
- * Ben Goodger (30/09/99)
- */
-
- // The WIZARD of GORE
-
- //var profile = Components.classes["@mozilla.org/profile/manager;1"].createInstance();
- //profile = profile.QueryInterface(Components.interfaces.nsIProfile);
-
- var migrationScreenName = "";
- var migrationPassword = "";
- var migrationSource = "";
- var migrationScreenNameVec = "";
- var migrationScreenNameVecSize = 0;
-
- // Navigation Set for pages contained in wizard
- var wizardMap = {
- migWiz0_0_0: { previous: null, next: "migWiz1_0_0", finish: false },
- migWiz0_0_1: { previous: null, next: "migWiz2_0_0", finish: false },
- migWiz1_0_0: { previous: "migWiz0_0_0", next: null, finish: true },
- migWiz1_1_0: { previous: "migWiz1_0_0", next: null, finish: true },
- migWiz2_0_0: { previous: "migWiz0_0_1", next: null, finish: true },
- migWiz2_1_0: { previous: "migWiz3_0_0", next: null, finish: true },
- migWiz2_1_1: { previous: "migWiz2_0_0", next: null, finish: true },
- migWiz3_0_0: { previous: "migWiz0_0_1", next: "migWiz2_1_0", finish: false },
- migWiz4_0_0: { previous: "migWiz0_0_1", next: null, finish: true },
- //newProfile1_2: { previous: "newProfile1_1", next: null, finish: true },
- }
-
- // page specific variables
- var profName = "";
- var profDir = "";
- var wizardManager = null;
-
- // startup procedure
- function Startup( startPage, frame_id )
- {
- if( frame_id == "" ) {
- dump("Please supply a content_frame ID!");
- return false;
- }
-
- // instantiate the Wizard Manager
- wizardManager = new WizardManager( frame_id, null, null, wizardMap );
- wizardManager.URL_PagePrefix = "chrome://aim/content/";
- wizardManager.URL_PagePostfix = ".xul";
-
- // set the button handler functions
- wizardManager.SetHandlers( null, null, onFinish, onCancel, null, null );
-
- //determine starting wizard panel
-
- var firstScreen = aimPrefsManager().GetCharPref("aim.session.screenname", null, true);
-
-
- if (!firstScreen || firstScreen == '') {
- //first time logging in with no screen name
- startPage='migWiz0_0_1'
-
- }
-
-
- // load the start page
- //dump("calling loadpage...\n");
- //dump("startPage:: " + startPage + "\n");
-
- wizardManager.LoadPage( startPage, false );
- // move to center of screen if no opener, otherwise, to center of opener
- if( window.opener )
- moveToAlertPosition();
- else
- centerWindowOnScreen();
- }
-
- function onCancel()
- {
- if( top.window.opener )
- window.close();
- else {
- try {
- profile.forgetCurrentProfile();
- }
- catch (ex) {
- dump("failed to forget current profile.\n");
- }
- ExitApp();
- }
- }
-
- function onFinish(){
- dump("*** IN ONFINISH\n");
-
- var sname = "";
- var pword = "";
- //when I am finished - check which page I finished on then set the parent if necessary
- if(wizardManager.currentPageTag=="migWiz2_0_0" || wizardManager.currentPageTag=="migWiz4_0_0" ){
- //alert(document.frames.length);
- //sname=wizardManager.wizardMap[wizardManager.currentPageTag].inputscreename
- //pword=wizardManager.wizardMap[wizardManager.currentPageTag].inputpassword
- //alert(sname);
- pword = top.frames[0].document.getElementById("inputpassword").value
- if ( wizardManager.currentPageTag=="migWiz4_0_0" ) {
- var list = top.frames[0].document.getElementById("menulistscreenname");
- var selIndex = list.selectedIndex;
- dump( "selIndex is " + selIndex + "\n" );
- if ( selIndex == 0 )
- sname = parent.migrationScreenName;
- else
- sname = parent.migrationScreenNameVec[ selIndex - 1 ];
- } else
- sname = top.frames[0].document.getElementById("inputscreename").value
-
- dump( "sname is " + sname + "\n" );
-
- //dump("sname:"+ sname+"\n");
- //sname='goog'
- //pword='magog'
- }
-
- if(wizardManager.currentPageTag=="migWiz2_1_0"){
- sname = top.frames[0].document.getElementById("inputscreename").value
- pword = top.frames[0].document.getElementById("inputpassword").value
-
- }
-
- cmdRegisterRemoteScreenNameWiz(wizardManager.currentPageTag,sname,pword);
- aimPrefsManager().SetBoolPref("aim.session.finishedwizard",true, null, true);
- var checkbox = top.frames[0].document.getElementById("migrateScreenNameCheck");
- if ( checkbox && checkbox.checked == false ) {
- aimPrefsManager().SetCharPref("aim.session.migrateBuddyList",sname, null, true);
- }
-
- window.close();
-
- }
-
-
- /** void ExitApp( void ) ;
- * - purpose: quits the application properly and finally, stops event loop
- * - in: nothing
- * - out: nothing
- **/
- function ExitApp()
- {
- // Need to call this to stop the event loop
- var appShell = Components.classes['@mozilla.org/appshell/appShellService;1'].getService();
- appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService);
- appShell.Quit();
- }
-
- // load string bundle
- //var bundle = srGetStrBundle("chrome://communicator/locale/profile/createProfileWizard.properties");
-
-
- //set up login screen
- function cmdRegisterRemoteScreenNameWiz(panelName,sn,pw) {
-
- if(sn == "")
- sn = aimPrefsManager().GetCharPref("aim.session.screenname", null, true);
-
- aimPrefsManager().SetCharPref("aim.session.screenname", sn, null, true);
- if(pw != "")
- {
- aimSessionSavePassword(pw);
- aimPrefsManager().SetBoolPref("aim.session.storepassword", true, null, false);
- }
-
- aimPrefsManager().SetBoolPref("aim.session.autologin", false, null, false);
-
- //parent.arguments[0].getElementById('fldScreenName').value = sn;
- //parent.arguments[0].getElementById('fldPassword').value = pw;
- //parent.arguments[0].getElementById('chkSavePassword').checked = false;
- //parent.arguments[0].getElementById('chkSavePassword').disabled = false;
- //parent.arguments[0].getElementById('chkAutoLogin').checked = false;
-
- wizard_AimSession_Register(sn)
-
- top.close()
-
-
- }
-
-
-
- function wizard_AimSession_Register(screenName)
- {
- if(aimSession())
- aimSession().RegisterScreenName(screenName);
- }
-
-